package com.hippo.core.core.network


import android.util.Log
import com.hippo.core.core.network.response.ApiResponse


suspend fun <T> safeApi(block: suspend () -> ApiResponse<T>): ApiResponse<T> {
    return try {
        block()
    }catch (e:Exception){
        e.printStackTrace()
        Log.e("okhttp", "safeApi error",e)
        ApiResponse.failure("网络异常")
    }
}